import React, { Component } from 'react';
import { Modal, Button } from 'antd';
import {connect} from 'react-redux'

// 引入自定义操作
import { ChangeAboutMoneyActivate } from '../../redux/actions/aboutMoney';
import  WithdrawForm  from './withdrawForm'
import RechargeForm from './rechargeForm';

class AboutMoney extends React.Component {

    handleCancel = () => {
        this.props.ChangeAboutMoneyActivate({
            activate: false,
            is_recharge: false,
            is_withdraw: false
        })
    }

    render() {

        const { aboutMoney_actState } = this.props

        return (
            <div>
                <Modal 
                    title="系统提示" 
                    visible={aboutMoney_actState.activate} 
                    onCancel={this.handleCancel}
                    footer={[]}
                >
                    {
                        aboutMoney_actState.is_withdraw ? <WithdrawForm /> : null
                    }
                    {
                        aboutMoney_actState.is_recharge ? <RechargeForm /> : null
                    }                    
                </Modal>
            </div>
        )
    }
}

export default connect(
    state =>({
        aboutMoney_actState: state.AboutMoneyReducer.aboutMoney_act
    }),
    {
        ChangeAboutMoneyActivate,
    }
)(AboutMoney)